#include <cstdio>
using namespace std;

const int kMaxN = 500000 + 10;

int sum[kMaxN];

int main() {
  int n;

  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int x, y;

    scanf("%d%d", &x, &y);
    if (sum[i - 1] - sum[i - 1 - x] >= y) {
      sum[i] = 1;
    }
    sum[i] += sum[i - 1];
  }
  printf("%d\n", sum[n]);
  return 0;
}